var dianpu = {};
dianpu.argumentType = "title";
dianpu.currentRuleButton = "";
dianpu.currentTemplateButton = "";
dianpu.dateFormat = 'yy-mm-dd';
dianpu.monthNames = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'];
dianpu.dayNamesMin = ['日','一','二','三','四','五','六'];
(function(product){
		var 
		_callback ={},
		rules = {
				"email" : "^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"
		},
		
		//返回
		_goToFun = function(url,cateIndex,liIndex){
					window.location.href=url;
					parent.document.getElementById('nav').contentWindow.NAV.current(cateIndex,liIndex);
		},
		_validate = function(rule,id,message){
				var RegExpObject = new RegExp(rule);
				if (!RegExpObject.test($(id).val())) {
						if (message){
								alert(message);
								$(id).focus();
						}
						return false;
				}
				return true;
		};
		
		product.init = function(page, parms) {
				if(!parms) {
						parms = {};
				}
				
				if( typeof _callback[page] === "function" ) {
						_callback[page].call(this, parms);
				}
				else {
						alert("没有为页面" + page + "定义callback函数，请联系前端");
				}	
		};
		
    _callback["dianpu_verify"] = function(parms) {
				$("#start-time,#end-time,#start-time2,#end-time2").datepicker({dateFormat:dianpu.dateFormat,monthNames:dianpu.monthNames,dayNamesMin:dianpu.dayNamesMin,minDate:parms.minDate});
				YUI({
						modules:{
								'k2-cdselector-skin':{//默认皮肤
										fullpath:'http://k.kbcdn.com/k2/cdselector/assets/cdselector-1-0-0.css',
										type:'css'
								},
								'k2-cdselector-base':{
										fullpath:'http://k.kbcdn.com/k2/cdselector/cdselector-base-1-0-0.js',
										requires:['k2-cdselector-skin',"base","node","event","json-parse","array"]
								},
								'k2-cdselector':{
										fullpath:'http://k.kbcdn.com/k2/cdselector/cdselector-1-0-0.js',
										requires:['k2-cdselector-skin',"k2-cdselector-base","node","event","json-parse","array"]
								},
								'k2-regionCode':{
										fullpath:'http://k.kbcdn.com/k2/cdselector/cds-data-region-1-0-0.js',
										requires:['k2-cdselector-base']
								}
						}
				}).use("k2-regionCode","k2-cdselector",function(Y){
						var cdselector_a=new Y.Cdselector({
								containerId:"cdselector",
								config:{
										renderType:1,
										levelNum:3,
										jsonName:parms.cdName,
										limitArray:[false,false,true],
										dataSource:Y.Cdselector_Base.regionCode
							 }
						});
						cdselector_a.select(parms.cdCode);
				});
		};
})(dianpu);